// import {createStore,legacy_createStore} from 'redux'
import { createStore } from 'redux'
// 在安装好了浏览器中的redux-devtools插件后，有此库就可以在浏览器中调试了
import { composeWithDevTools } from '@redux-devtools/extension'

// 初始数据源
const initState = {
  n: 200
}

const reducer = (state = initState, action) => {
  if (action.type === 'add') {
    return { ...state, n: state.n + action.data }
  }
  return state
}

const store = createStore(reducer, composeWithDevTools())

export default store
